<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Construct a new V8Js object</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="class.v8js.html">« V8Js</a></li>
      <li style="float: right;"><a href="v8js.executestring.html">V8Js::executeString »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.v8js.html">V8Js</a></li>
    <li>Construct a new V8Js object</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="v8js.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">V8Js::__construct</h1>
  <p class="verinfo">(PECL v8js &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">V8Js::__construct</span> &mdash; <span class="dc-title">Construct a new <span class="classname"><a href="class.v8js.html" class="classname">V8Js</a></span> object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-v8js.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>V8Js::__construct</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$object_name</code><span class="initializer"> = &quot;PHP&quot;</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">array</span> <code class="parameter">$variables</code><span class="initializer"> = array()</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">array</span> <code class="parameter">$extensions</code><span class="initializer"> = array()</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">bool</span> <code class="parameter">$report_uncaught_exceptions</code><span class="initializer"> = <strong><code>true</code></strong></span></span><br>)</div>

  <p class="para rdfs-comment">
   Constructs a new <span class="classname"><a href="class.v8js.html" class="classname">V8Js</a></span> object.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-v8js.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">object_name</code></dt>

    <dd>

     <p class="para">
      The name of the object passed to Javascript.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">variables</code></dt>

    <dd>

     <p class="para">
      Map of PHP variables that will be available in Javascript. Must be an associative <span class="type">array</span>
      in format <code class="literal">array(&quot;name-for-js&quot; =&gt; &quot;name-of-php-variable&quot;)</code>. Defaults to empty array.
     </p> 
    </dd>

   
   
    <dt>
<code class="parameter">extensions</code></dt>

    <dd>

     <p class="para">
      List of extensions registered using <span class="function"><a href="v8js.registerextension.html" class="function">V8Js::registerExtension()</a></span> which should be available 
      in the Javascript context of the created <span class="classname"><a href="class.v8js.html" class="classname">V8Js</a></span> object.
      <blockquote class="note"><p><strong class="note">注意</strong>: 
       <p class="para">
        Extensions registered to be enabled automatically do not need to be listed in this array.
        Also if an extension has dependencies, those dependencies can be omitted as well. Defaults to empty array.
       </p>
      </p></blockquote>
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">report_uncaught_exceptions</code></dt>

    <dd>

     <p class="para">
      Controls whether uncaught Javascript exceptions are reported immediately or not. Defaults to <strong><code>true</code></strong>. If set to <strong><code>false</code></strong>
      the uncaught exception can be accessed using <span class="function"><a href="v8js.getpendingexception.html" class="function">V8Js::getPendingException()</a></span>.
     </p>
    </dd>

   
  </dl>

 </div>


</div></div></div></body></html>